//!@author denglibin
//!@date 2025/6/3 16:52
//!@desc

mod tests {
    use rust_my_tools::dao::sqlserver::sql_server_dao;
    use rust_my_tools::dao::sqlserver2sqlite::sqlserver2sqlite_auto;
    use rust_my_tools::sys::global::GlobalResult;

    const HOST: &str = "localhost";
    const PORT: u16 = 1433;
    const DATA_BASE: &str = "suoyinshuju1";
    const USER: &str = "sa";
    const PASSWORD: &str = "Yiscn123456@";

    const TABLE_NAME: &str = "es";
    use rust_my_tools::entity;

    #[test]
    pub fn test_vec_drain() {
        let mut v = vec![1, 2, 3];
        let u: Vec<_> = v.drain(1..).collect();
        println!("{:?}", u);
        assert_eq!(v, &[1]);
        assert_eq!(u, &[2, 3]);
    }



    ///导出数据
    pub async fn copy_es(size: usize) -> GlobalResult<()> {
        let mut client = sql_server_dao::get_client(HOST, PORT, DATA_BASE, USER, PASSWORD)
            .await
            .unwrap();

        sqlserver2sqlite_auto(
            &mut client,
            "xxzx_id",
            0,
            TABLE_NAME,
            format!("{}.db", TABLE_NAME).as_str(),
            size,
        )
            .await
    }

}

